<template>
	<view>
		<f-popup ref="popup" position="center" width="690rpx">
			<view class="content">
				<view class="title">
					<text>{{ userInfo.user.login_phone }}，您好</text>
				</view>
				<form>
					<view class="form-item">
						<view class="lable">
							<text>真实姓名</text><text class="text-red">*</text>
						</view>
						<view class="form-body">
							<input type="text" v-model="formData.roster_name" placeholder="请输入真实姓名">
						</view>
					</view>
					
					<view class="">
						<button @click="submit">确定</button>
					</view>
				</form>
			</view>
		</f-popup>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	
	export default {
		data() {
			return {
				formData: {
					roster_name: ''
				}
			};
		},
		computed:{
			...mapState('login', ['userInfo'])
		},
		methods:{
			submit() {
				this.$api.rosterNameApi(this.formData).then(res=> {
					this.close()
					uni.showToast({
						title: res.retmsg
					})
					setTimeout(()=>{
						uni.switchTab({
							url: '/pages/index/index'
						})
					}, 1200)
				}).catch(err=> {
					console.log('err', err);
				})
			},
			
			open() {
				this.$refs.popup.open()
			},
			close() {
				this.$refs.popup.close()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
		padding: 32rpx;
		border-radius: 16rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
		
		.title{
			font-size: 36rpx;
			font-weight: bold;
			padding-bottom: 24rpx;
		}
		
		.form-item{
			margin-bottom: 32rpx;
			
			.lable{
				font-size: 28rpx;
				margin-bottom: 12rpx;
			}
			
			.form-body{
				border-radius: 8rpx;
				border: 1rpx solid #eee;
				
				textarea{
					padding: 12rpx;
					height: 120rpx;
					font-size: 28rpx;
				}
				
				input{
					height: 72rpx;
					padding: 12rpx;
					font-size: 28rpx;
					line-height: 72rpx;
				}
				
				.datetime{
					height: 72rpx;
					padding: 12rpx;
					font-size: 28rpx;
					line-height: 72rpx;
				}
			}
		}
		
		button{
			height: 84rpx;
			color: #FFFFFF;
			font-size: 32rpx;
			line-height: 84rpx;
			border-radius: 8rpx;
			background-color: var(--primary-color);
			
			&::after{
				border: none;
			}
		}
	}
</style>
